﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DTO;

namespace DAO
{
   public class TinhTrangDAO
    {
       public string TenTinhTrang(int matt)
       {
           SqlConnection conn = new SqlConnection();
           conn = DataProvider.ConnectDB();

           SqlCommand cmd = new SqlCommand("proc_TenTinhTrang", conn);
           cmd.CommandType = CommandType.StoredProcedure;

           SqlParameter sqlPar;
           sqlPar = new SqlParameter("@matt", SqlDbType.Int);
           sqlPar.Direction = ParameterDirection.Input;
           sqlPar.Value = matt;
           cmd.Parameters.Add(sqlPar);

           sqlPar = new SqlParameter("@tentt", SqlDbType.NVarChar,30);
           sqlPar.Direction = ParameterDirection.Output;
           cmd.Parameters.Add(sqlPar);
           cmd.ExecuteNonQuery();

           conn.Close();
           return cmd.Parameters["@tentt"].Value.ToString();           
       }
    }
}
